/**
 * Created by Administrator on 2016/10/30.
 */
class State_HeadToTarget extends BaseState {

    count: number;

    play() {
        super.play();

        let gameView: GameScene = GSController.i.gsView;
        let headView: HeadIcon;
        let pos;
        for (let i: number = 1; i <= game.roomSeat; i++) {
            headView = gameView.headViews[i];
            pos = GSConfig.headTargetPos[i];
            egret.Tween.get(headView)
                .to({x: pos.x, y: pos.y}, 100)
                .call(this.moveComplete, this);
        }
    }

    moveComplete() {
        this.count++;
        if (this.count >= game.roomSeat) {
            this.exit();
            GSStateMgr.i.setState(GSState.State_CardPutline);
        }
    }

    update(advanceTime: number, timeStamp?: number): void {
        if (this.completed) return;
    }

    reset() {
        super.reset();
        this.count = 0;
    }
}